﻿using System.Collections.Generic;
using ZYLFramework.Common;

namespace ZYLFramework.Manage.ECS
{
    public class EntityManage:MonoSingleton<ResourcesManage>
    {
        public List<int> EntityIdList;
        public List<BaseComponent> BaseComponents;
        public int CommonIndex;

        public EntityManage()
        {
            EntityIdList = new List<int>();
            CommonIndex = 0;
        }

        public int NewEntity()
        {
            var index = GetEntityId();
            EntityIdList.Add(index);
            return index;
        }
        
        public int GetEntityId()
        {
            var index = CommonIndex;
            CommonIndex++;
            return index;
        }
        
        public void AddComponent()
        {
            var index = GetEntityId();
            EntityIdList.Add(index);
        }
    }
}